package com.fh.controller;

import com.fh.util.UploadFileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author huangp
 * @create 2020-07-15 14:25
 */
@Controller
@RequestMapping("FileUploadController")
public class FileUploadController {

    @Autowired
    private HttpServletRequest request;

    /**
     * 上传图片
     * @return
     */
    @RequestMapping("uploadFile")
    @ResponseBody
    public Map<String, Object> uploadFile(MultipartFile fileImg)
    {
        return UploadFileUtil.uploadFileInput(fileImg, request);
    }


}
